<?php
/**
 * #Celebrate Shieh
 *             ,%%%%%%%%,
 *           ,%%/\%%%%/\%%
 *          ,%%%\c "" J/%%%
 * %.       %%%%/ o  o \%%%
 * `%%.     %%%%    _  |%%%
 *  `%%     `%%%%(__Y__)%%'
 *  //       ;%%%%`\-/%%%'
 * ((       /  `%%%%%%%'
 *  \\    .'          |
 *   \\  /       \  | |
 *    \\/         ) | |
 *     \         /_ | |__
 *     (___________))))))) 攻城湿
 *
 *        _       _
 * __   _(_)_   _(_) __ _ _ __
 * \ \ / / \ \ / / |/ _` |'_ \
 *  \ V /| |\ V /| | (_| | | | |
 *   \_/ |_| \_/ |_|\__,_|_| |_|
 */

namespace App\Http\Controllers\Admin\Blog;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class LinkController extends Controller
{

    /**
     * 友情链接首页
     *
     * @param Request $request
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index( Request $request )
    {
        return $this->getLink()->LinkIndexService($request);
    }

    /**
     * 友情链接新增页面
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function create()
    {
        return view('blog.link.create');
    }

    /**
     * 友情链接添加
     *
     * @param Request $request
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function store( Request $request )
    {
        return $this->getLink()->LinkStoreService($request);
    }

    /**
     * 友情链接编辑
     *
     * @param $id
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function edit( $id )
    {
        return $this->getLink()->LinkEditService($id);
    }

    /**
     * 友情链接更新
     *
     * @param         $id
     * @param Request $request
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function update( $id, Request $request )
    {
        request()->offsetSet('id', $id);
        return $this->getLink()->LinkUpdateService($request);
    }

    /**
     * 友情链接删除
     *
     * @param $id
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function destroy( $id )
    {
        return $this->getLink()->LinkDestroyService($id);
    }

    /**
     * 友情链接修改状态
     *
     * @param $id
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function status( $id )
    {
        return $this->getLink()->LinkStatusService($id);
    }

    /**
     * 友情链接批量删除
     *
     * @param Request $request
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function delete( Request $request )
    {
        return $this->getLink()->LinkDeleteService($request);
    }
}
